public class Test1 {
    public static void main(String[] args) {
//        try {
//            int i = 9 / 1;
//            System.exit(0);
//        }catch (Exception e){
//            e.printStackTrace();
//        }finally{
//            System.out.println("finally");
//        }
//        System.out.println("*******");

        System.out.println(getx());
        System.out.println(gety());

        System.out.println(getz().x);
    }

    public static int getx(){
        try{
            return 1;
        }catch(Exception e){
            return 2;
        }
        finally {
            return 3;
        }
    }

    public static int gety(){
        int x = 1;
        try{
            return x;
        }catch(Exception e){
            return 2;
        }
        finally {
            x = 2;
        }
    }

    public static MyObj getz(){
        MyObj obj = new MyObj();
        obj.x = 1;
        try{
            return obj;
        }catch(Exception e){
            obj.x = 2;
        }
        finally {
            obj.x = 3;
        }
        return null;
    }
}
class MyObj{
    public int x = 1;
}
